package com.ali.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：ALi
 * @date ：Created in 2022/7/5 14:59
 * @description：路由配置类
 * @modified By：
 * @version: $
 */
@Configuration
public class GateWayConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder){

        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_route1", r -> r.path("/guoji").uri("http://news.baidu.com/guonei")).build();

        return routes.build();

    }
}